package com.vrv.netmgr.assets.detail;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.TextView;

import com.vrv.common.GlobalConstants;
import com.vrv.netmgr.R;
import com.vrv.netmgr.vo.HardwareChange;

/**
 * @Description 注册资产查询策略详细信息
 * @author yangzijian
 * @date
 *
 */
public class DetailHandwareChangeActivity extends Activity {
    private static final String TAG = DetailHandwareChangeActivity.class.getSimpleName();
    private static final boolean DEBUG = true && GlobalConstants.DEBUG;
    //
    private HardwareChange info;
    public void onCreate(Bundle savedInstanceState){
        if(DEBUG) Log.v(TAG, "onCreate()");
        
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.detail_hardwarechange);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.common_title);
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
        //
        initViews();
        setTitle();
    }
    //
    public void initViews(){
        if(DEBUG) Log.v(TAG, "initViews()");
        
        //
        TextView hdwc_className = (TextView) findViewById(R.id.hdwc_className);
        TextView hdwc_deptName = (TextView) findViewById(R.id.hdwc_deptName);
        TextView hdwc_officeName = (TextView) findViewById(R.id.hdwc_officeName);
        TextView hdwc_userName = (TextView) findViewById(R.id.hdwc_userName);
        TextView hdwc_tel = (TextView) findViewById(R.id.hdwc_tel);
        TextView hdwc_ipaddres = (TextView) findViewById(R.id.hdwc_ipaddres);
        TextView hdwc_deviceName = (TextView) findViewById(R.id.hdwc_deviceName);
        TextView hdwc_equpName = (TextView) findViewById(R.id.hdwc_equpName);
        TextView hdwc_old1 = (TextView) findViewById(R.id.hdwc_old1);
        TextView hdwc_new1 = (TextView) findViewById(R.id.hdwc_new1);
        TextView hdwc_changeTime = (TextView) findViewById(R.id.hdwc_changeTime);
        //
        info = (HardwareChange) getIntent().getSerializableExtra("info");
        //
        hdwc_className.setText(info.getHdwc_className());
        hdwc_deptName.setText(info.getHdwc_deptName());
        hdwc_officeName.setText(info.getHdwc_officeName());
        hdwc_userName.setText(info.getHdwc_userName());
        hdwc_tel.setText(info.getHdwc_tel());
        hdwc_ipaddres.setText(info.getHdwc_ipaddres());
        hdwc_deviceName.setText(info.getHdwc_deviceName());
        hdwc_equpName.setText(info.getHdwc_equpName());
        hdwc_old1.setText(info.getHdwc_old1());
        hdwc_new1.setText(info.getHdwc_new1());
        hdwc_changeTime.setText(info.getHdwc_changeTime());
    }
    public void setTitle() {
        if(DEBUG) Log.v(TAG, "setTitle()");
        
        TextView title = (TextView) findViewById(R.id.title_text);
        title.setText("硬件变化查询"+"["+info.getHdwc_ipaddres()+"]");

        /**
         * 返回按钮
         */
        ImageButton backBtn = (ImageButton) findViewById(R.id.backBtn);
        backBtn.setVisibility(View.VISIBLE);
        backBtn.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
    }
    @Override
    public void onBackPressed() {
        if(DEBUG) Log.v(TAG, "onBackPressed()");
        
        finish();
        overridePendingTransition(R.anim.push_right_out, R.anim.push_right_in);
        super.onBackPressed();
    }
}
